package com.hehe;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.util.Properties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import java.net.InetAddress;


@SpringBootApplication
public class RootApplication {
	public static void main(String[] args) throws IOException {

//		String IPv4_address = InetAddress.getLocalHost().getHostAddress();
//		System.out.println("IPv4_address = " + IPv4_address);

		ConfigurableApplicationContext application = SpringApplication.run(RootApplication.class, args);
		Environment env = application.getEnvironment();
		String ip = InetAddress.getLocalHost().getHostAddress();
		String port = env.getProperty("server.port");
		String datasource_url = env.getProperty("spring.datasource.url");
		String property = env.getProperty("server.servlet.context-path");
		String path = property == null ? "" :  property;
		System.out.println(
				"\n\t" +
						"----------------------------------------------------------\n\t" +
						"datasource_url = " + datasource_url + "\n\t" +
						"Application Sailrui-Boot is running! Access URLs:\n\t" +
						"Local: \t\thttp://localhost:" + port + path + "/\n\t\n\t" +
						"External: \thttp://" + ip + ":" + port + path + "/\n\t\n\t" +
						"------------------------------------------------------------");

		System.out.println("          注意 :     ");
		System.out.println("  1.记得打开 phpstudy 内置的MySQL 服务器, 不然web应用没办法正常访问...");
		System.out.println("  2.mybatis 和 JPA 不兼容 , 不能放在同一个 pom.xml  文件中  ");
		System.out.println("  3.在Intelij IDEA中修改maven为国内镜像（阿里）" );
		System.out.println("             ----------------             ");


	}
}




